Optimal. Leaf size=149 \[ a^3 x (b B-a C)+\frac {b^2 \left (a^2 (-C)+9 a b B+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {b \left (-4 a^3 C+6 a^2 b B+2 a b^2 C+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^3 (2 a C+3 b B) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {b^2 C \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.31, antiderivative size = 149, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 48, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {4041, 3918, 4048, 3770, 3767, 8} \[ \frac {b^2 \left (a^2 (-C)+9 a b B+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {b \left (6 a^2 b B-4 a^3 C+2 a b^2 C+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^3 x (b B-a C)+\frac {b^3 (2 a C+3 b B) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {b^2 C \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3767
Rule 3770
Rule 3918
Rule 4041
Rule 4048
Rubi steps
\begin {align*} \int (a+b \sec (c+d x))^2 \left (a b B-a^2 C+b^2 B \sec (c+d x)+b^2 C \sec ^2(c+d x)\right ) \, dx &=\frac {\int (a+b \sec (c+d x))^3 \left (b^2 (b B-a C)+b^3 C \sec (c+d x)\right ) \, dx}{b^2}\\ &=\frac {b^2 C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {\int (a+b \sec (c+d x)) \left (3 a^2 b^2 (b B-a C)+b^3 \left (6 a b B-3 a^2 C+2 b^2 C\right ) \sec (c+d x)+b^4 (3 b B+2 a C) \sec ^2(c+d x)\right ) \, dx}{3 b^2}\\ &=\frac {b^3 (3 b B+2 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b^2 C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {\int \left (6 a^3 b^2 (b B-a C)+3 b^3 \left (6 a^2 b B+b^3 B-4 a^3 C+2 a b^2 C\right ) \sec (c+d x)+2 b^4 \left (9 a b B-a^2 C+2 b^2 C\right ) \sec ^2(c+d x)\right ) \, dx}{6 b^2}\\ &=a^3 (b B-a C) x+\frac {b^3 (3 b B+2 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b^2 C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \left (b^2 \left (9 a b B-a^2 C+2 b^2 C\right )\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (b \left (6 a^2 b B+b^3 B-4 a^3 C+2 a b^2 C\right )\right ) \int \sec (c+d x) \, dx\\ &=a^3 (b B-a C) x+\frac {b \left (6 a^2 b B+b^3 B-4 a^3 C+2 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^3 (3 b B+2 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b^2 C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (b^2 \left (9 a b B-a^2 C+2 b^2 C\right )\right ) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^3 (b B-a C) x+\frac {b \left (6 a^2 b B+b^3 B-4 a^3 C+2 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 \left (9 a b B-a^2 C+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {b^3 (3 b B+2 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b^2 C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.93, size = 114, normalized size = 0.77 \[ \frac {6 a^3 d x (b B-a C)+3 b \left (-4 a^3 C+6 a^2 b B+2 a b^2 C+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))+3 b^3 \tan (c+d x) \sec (c+d x) (2 (3 a B+b C) \cos (c+d x)+2 a C+b B)+2 b^4 C \tan ^3(c+d x)}{6 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.71, size = 199, normalized size = 1.34 \[ -\frac {12 \, {\left (C a^{4} - B a^{3} b\right )} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (4 \, C a^{3} b - 6 \, B a^{2} b^{2} - 2 \, C a b^{3} - B b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (4 \, C a^{3} b - 6 \, B a^{2} b^{2} - 2 \, C a b^{3} - B b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, C b^{4} + 2 \, {\left (9 \, B a b^{3} + 2 \, C b^{4}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (2 \, C a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.30, size = 301, normalized size = 2.02 \[ -\frac {6 \, {\left (C a^{4} - B a^{3} b\right )} {\left (d x + c\right )} + 3 \, {\left (4 \, C a^{3} b - 6 \, B a^{2} b^{2} - 2 \, C a b^{3} - B b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (4 \, C a^{3} b - 6 \, B a^{2} b^{2} - 2 \, C a b^{3} - B b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (18 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, C a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 36 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, C b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 1.14, size = 228, normalized size = 1.53 \[ B x \,a^{3} b +\frac {B \,a^{3} b c}{d}-a^{4} C x -\frac {C \,a^{4} c}{d}+\frac {3 a^{2} b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}-\frac {2 a^{3} b C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {3 B a \,b^{3} \tan \left (d x +c \right )}{d}+\frac {C a \,b^{3} \sec \left (d x +c \right ) \tan \left (d x +c \right )}{d}+\frac {C a \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {B \,b^{4} \sec \left (d x +c \right ) \tan \left (d x +c \right )}{2 d}+\frac {B \,b^{4} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2 d}+\frac {2 C \,b^{4} \tan \left (d x +c \right )}{3 d}+\frac {C \,b^{4} \tan \left (d x +c \right ) \left (\sec ^{2}\left (d x +c \right )\right )}{3 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.35, size = 204, normalized size = 1.37 \[ -\frac {12 \, {\left (d x + c\right )} C a^{4} - 12 \, {\left (d x + c\right )} B a^{3} b - 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C b^{4} + 6 \, C a b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 3 \, B b^{4} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 24 \, C a^{3} b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) - 36 \, B a^{2} b^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) - 36 \, B a b^{3} \tan \left (d x + c\right )}{12 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.72, size = 576, normalized size = 3.87 \[ \frac {\frac {B\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {C\,b^4\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {C\,b^4\,\sin \left (c+d\,x\right )}{2}+\frac {3\,B\,a\,b^3\,\sin \left (c+d\,x\right )}{4}-\frac {3\,C\,a^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {B\,b^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}+\frac {3\,B\,a\,b^3\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {C\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{2}-\frac {C\,a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {B\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}+\frac {B\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {B\,a^2\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{2}-\frac {C\,a\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{2}+C\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}-\frac {B\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{2}+\frac {3\,B\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {C\,a\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{2}+C\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ - \int C a^{4}\, dx - \int \left (- B a^{3} b\right )\, dx - \int \left (- B b^{4} \sec ^{3}{\left (c + d x \right )}\right )\, dx - \int \left (- C b^{4} \sec ^{4}{\left (c + d x \right )}\right )\, dx - \int \left (- 3 B a b^{3} \sec ^{2}{\left (c + d x \right )}\right )\, dx - \int \left (- 3 B a^{2} b^{2} \sec {\left (c + d x \right )}\right )\, dx - \int \left (- 2 C a b^{3} \sec ^{3}{\left (c + d x \right )}\right )\, dx - \int 2 C a^{3} b \sec {\left (c + d x \right )}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________